<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>个人信息</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui-win.css"/>
    <link rel="stylesheet" href="../../css/DateTimePicker.css"/>
    <style>
        html, body {
            width: 100%;
            min-height: 100%;
            background: #f0f0f0;
        }
        .fr {
            float: right;
        }

        .login {
            background-repeat: no-repeat;
            background-size: contain;
            position:relative;
        }

        .loginbg {
            /*position: absolute;*/
            width: 100%;
            height: 150px;
        }

        .login .personal_logo {
            position: absolute;
            top: 35px;
            left: 50%;
            /*width: 100px;*/
            border-radius: 50%;
            width: 80px;
            height: 80px;
            margin-left: -40px;
        }

        /* 登陆样式 */
        .content .item {
            margin: 10px 10px 0px 10px;
            background-color: #fff;
            height: 50px;
            line-height: 50px;
            border: 1px solid #e0e0e0;
        }


        /*上传头像CSS*/

    
        #loading{
position:absolute;
width:300px;
top:100px;
left:50%;
margin-left:-150px;
text-align:center;
padding:7px 0 0 0;
font:bold 11px Arial, Helvetica, sans-serif;
}

#input-image{
	width:90px;
	height:90px;
	position:absolute;
	top:35px;
	left:50%;
	margin-left:-45px;
	border:none;
	background:none;
	outline:none;
}
.content_div{
  width: 100%;
  height: 40px;
  background: white;
  margin-top: 10px;
}
.content_div label{
  width: 28%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  padding-left: 2%;
  color: #999;
  float:left;
}
.content_div input{
  width: 70%;
  height: 40px;
  line-height: 40px;
  float:left;
}
.content_div label span{
  color: white;
}
#sex{
	height:40px;
	border:none;
	width:15%;
	background:none;
}
    </style>
</head>
<body>
    <!--头部-->
    <header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back" onclick="back_go()"> <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
			编辑个人信息
		</div>
        <a class="aui-iconfont aui-icon-menu aui-pull-right" onclick="savemyinfo();" style="position:absolute;top:0;right:15px;")>保存</a>
    </header>
    <div class="margin_div"></div>
    <!--下方主体-->
    <div id="content-wrap">
        <div id="upImgDiv">
            
        </div>
        <div class="login" >
            <img src="../../image/my/personalBg.png" alt="" class="loginbg">
        </div>
        <form method="get" action="">

		  <div data-role="fieldcontain" class="content_div">
		    <label for="name">姓<span>空空</span>名：</label>
		    <input type="text" name="text" id="txtname" value="" placeholder="你的姓名是？">
		    </div>
		    
		    <div data-role="fieldcontain" class="content_div">
		    <label>性<span>空空</span>别：</label>
		     <select id="sex">  
  				<option value ="男">男</option>  
  				<option value ="女">女</option>  
			</select> 
		  </div>
		
		  <div data-role="fieldcontain" class="content_div">
		    <label for="date">出生日期：</label>
		    <input type="date" name="date" id="txtbriday" value="">
		  </div>
		   <div data-role="fieldcontain" class="content_div">
		    <label>籍<span>空空</span>贯：</label>
		     <input id="txtcity" type="text" placeholder="籍贯所在地">
		  </div>
		 
		</form>
    	
    </div>
    <!--加载loading功能-->
    <div id="loadIng_startStop" style="width: 100%;height: 100%;position: absolute;z-index: 1000;display: none;">
    	<div class="div_loding_img">
		数据加载中
		</div>
    </div>
</body>
<script src="../../script/jquery-1.10.2.min.js"></script>
<script src="../../script/common.js"></script>
<script>
var myName;
var mySex;
var myBirthday;
var myCity;
var did;
var comde;

	/*页面初始化构建*/
	$(document).ready(function(){
		getdata();
	    });
    /*ty新增的函数*/
    $("#back").click(function(){
        window.location = "mine.html"+"?mid="+$mid+"&groupid="+$groupid;
    });

    function getdata()
    {
		$("#txtname").val($myname);
		$("#txtsex").val($mysex);
		$("#txtcity").val($mynative);
		$("#txtbriday").val($mybirthday);
		
	    if($mysex=="女"){
			var a=document.getElementById("sex").options
			for(var i=0;i<a.length;i++){
				if(a[i].value=="女"){
					a[i].selected="selected";
					mySex=a[i].value;
					
				}
			}
		}
		else{
			mySex=$("#sex").val()
		
		}	
    }
    /*保存用户信息*/
    function savemyinfo(){
    	//$("#loading").show();
        myName = $("#txtname").val();
        myBirthday = $("#txtbriday").val();
        myCity = $("#txtcity").val();
        did =initdata.get('myinfo');
   	 var bodyParam={
 	            "groupid":$groupid,
 	            "tel":$mid,
 	            "did":did,
 	            "email":"1@yunzo.net",
 	            "mname":myName,
 	            "msex":mySex,
 	            "mheadimage":"null",
 	            "mbirthday":myBirthday,
 	            "mnativeplace":myCity
 	        };
       	
            ajaxCoCRequest("../../../api/account/profile", "POST", bodyParam, function(msg){
                if(msg.code==100){
              	 	 //$("#loading").hide();
              		var localData =  window.localStorage;
        			localData.setItem("userName",myName);
        			localData.setItem("userSex",mySex);
        			localData.setItem("userNative",myCity);
        			localData.setItem("userBirthday",myBirthday);
        			
                    var c =confirm("修改成功,继续修改？")
                    if(!c){
                        window.location="mine.html"+"?mid="+$mid+"&groupid="+$groupid;
                    }
                }else{
               	 $("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
               	
                }
               
            });
    }


	  $("#sex").change(function(){
		 mySex=$("#sex").val()
	  });




    /*loading加载转圈*/
    sTart_Stop();
</script>
</html>